package com.yujinglin.airline;

import org.apache.hadoop.io.Writable;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

public class airlineWritable implements Writable {
    String airline = null;
    int flihtNumber = 0;
    String tailNumber = null;
    String orign = null;
    String destination = null;

    public airlineWritable(){

    }

    public airlineWritable(String airline, int flihtNumber, String tailNumber, String orign, String destination) {
        this.airline = airline;
        this.flihtNumber = flihtNumber;
        this.tailNumber = tailNumber;
        this.orign = orign;
        this.destination = destination;
    }

    public airlineWritable(String airline, String tailNumber, String orign, String destination) {
        this.airline = airline;
        this.tailNumber = tailNumber;
        this.orign = orign;
        this.destination = destination;
    }

    @Override
    public void write(DataOutput out) throws IOException {
        out.writeUTF(airline);
        out.writeUTF(tailNumber);
        out.writeUTF(orign);
        out.writeUTF(destination);


    }


    @Override
    public void readFields(DataInput in) throws IOException {
        this.airline = in.readUTF();
        this.tailNumber = in.readUTF();
        this.orign = in.readUTF();
        this.destination = in.readUTF();

    }

    public String getAirline() {
        return airline;
    }

    public void setAirline(String airline) {
        this.airline = airline;
    }

    public int getFlihtNumber() {
        return flihtNumber;
    }

    public void setFlihtNumber(int flihtNumber) {
        this.flihtNumber = flihtNumber;
    }

    public String getTailNumber() {
        return tailNumber;
    }

    public void setTailNumber(String tailNumber) {
        this.tailNumber = tailNumber;
    }

    public String getOrign() {
        return orign;
    }

    public void setOrign(String orign) {
        this.orign = orign;
    }

    public String getDestination() {
        return destination;
    }

    public void setDestination(String destination) {
        this.destination = destination;
    }

    @Override
    public String toString() {
        return "airlineWritable{" +
                "airline='" + airline + '\'' +
                ", tailNumber='" + tailNumber + '\'' +
                ", orign='" + orign + '\'' +
                ", destination='" + destination + '\'' +
                '}';
    }
}
